package com.example.applicationevent.listener;

import com.example.applicationevent.event.DemoEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * <DemoEvent>指定监听事件类型
 * @author ljw
 * @definition
 * @date 2021/8/3 7:40
 */
@Component
public class DemoListener implements ApplicationListener<DemoEvent> {

    /* 对消息进行接受处理 */
    @Override
    public void onApplicationEvent(DemoEvent demoEvent) {
        String msg = demoEvent.getMsg();
        System.out.println("我（demoListener）接收到了 demoPublisher 发布的消息:" + msg);
    }
}
